package com.sphd.education.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.sphd.education.R;
import com.sphd.education.info.MsgInfo;

import java.text.SimpleDateFormat;
import java.util.Date;

import butterknife.Bind;
import butterknife.ButterKnife;
/*
* 系统消息详情
* */
public class SystemMsgsActivity extends AppCompatActivity {

    @Bind(R.id.toolbar)
    Toolbar toolbar;
    @Bind(R.id.tch_title)
    TextView tchTitle;
    @Bind(R.id.tch_date)
    TextView tchDate;
    @Bind(R.id.tch_content)
    TextView tchContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_system_msgs);
        ButterKnife.bind(this);
        toolbar.setTitle("消息");
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();//这是自带的箭头的返回的监听
            }
        });
        initView();
    }

    private void initView() {
        Intent intent =getIntent();
        MsgInfo msgInfo = (MsgInfo) intent.getSerializableExtra("sysmsg");
        tchDate.setText(new SimpleDateFormat("yyyy-MM-dd hh:mm").format(new Date(msgInfo.getCreatTime())));
                tchTitle.setText(msgInfo.getTitle());
        tchContent.setText(msgInfo.getContent());
    }

}
